/*!
 * @file Controller.inl
 * @author Rocco Martino
 */
/***************************************************************************
 *   Copyright (C) 2014 by Rocco Martino                                   *
 *   martinorocco@gmail.com                                                *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Lesser General Public License as        *
 *   published by the Free Software Foundation; either version 2.1 of the  *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU Lesser General Public      *
 *   License along with this program; if not, write to the                 *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef _OOGAME_CONTROLLER_INL
#define _OOGAME_CONTROLLER_INL




/* ======================================================================= */
/* ....................................................................... */
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline void
ooGame::Controller::setOperator( Operator controller_operator )
{
    m_operator = controller_operator ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline ooGame::Controller::Operator
ooGame::Controller::getOperator(void) const
{
    return m_operator ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline void
ooGame::Controller::setStateIndex( unsigned int state_index )
{
    m_state_index = state_index ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline unsigned int
ooGame::Controller::getStateIndex(void) const
{
    return m_state_index ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline void
ooGame::Controller::setActuatorList( const std::vector<unsigned int>& actuator_list )
{
    m_actuator_list = actuator_list ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline std::vector<unsigned int>&
ooGame::Controller::getActuatorList(void)
{
    return m_actuator_list ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline const std::vector<unsigned int>&
ooGame::Controller::getActuatorList(void) const
{
    return m_actuator_list ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline bool
ooGame::Controller::getStateBit(unsigned int state) const
{
    unsigned int    mask = 1 << m_state_index ;
    unsigned int    bit = mask & state ;

    return bit != 0 ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline void
ooGame::Controller::reset(void)
{
    m_accumulator = 0 ;
    m_num_sensors = 0 ;
}
/* ....................................................................... */
/* ======================================================================= */




#endif /* _OOGAME_CONTROLLER_INL */
